@rubytech/create-maxy 1.0.876 → 1.0.878
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/payload/platform/lib/graph-trash/dist/index.js +1 -1
- package/payload/platform/lib/graph-trash/dist/index.js.map +1 -1
- package/payload/platform/lib/graph-trash/src/index.ts +1 -1
- package/payload/platform/neo4j/edge-annotations.json +11 -3
- package/payload/platform/plugins/admin/hooks/__tests__/pre-tool-use-base64-guard.test.sh +204 -0
- package/payload/platform/plugins/admin/hooks/archive-ingest-surface-gate.sh +11 -5
- package/payload/platform/plugins/admin/hooks/pre-tool-use.sh +96 -0
- package/payload/platform/plugins/admin/skills/onboarding/SKILL.md +5 -1
- package/payload/platform/plugins/cloudflare/scripts/setup-tunnel.sh +88 -9
- package/payload/platform/plugins/cloudflare/skills/setup-tunnel/SKILL.md +1 -1
- package/payload/platform/plugins/docs/references/admin-session.md +80 -0
- package/payload/platform/plugins/docs/references/platform.md +3 -1
- package/payload/platform/plugins/docs/references/plugins-guide.md +1 -0
- package/payload/platform/plugins/memory/PLUGIN.md +4 -1
- package/payload/platform/plugins/memory/mcp/dist/index.js +127 -0
- package/payload/platform/plugins/memory/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-derive-insights.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-derive-insights.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-derive-insights.test.js +97 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-derive-insights.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-enrich-rejection.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-enrich-rejection.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-enrich-rejection.test.js +184 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-enrich-rejection.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.d.ts +89 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.js +542 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-enrich-rejection.d.ts +41 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-enrich-rejection.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-enrich-rejection.js +116 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-enrich-rejection.js.map +1 -0
- package/payload/platform/plugins/memory/skills/conversation-archive-enrich/SKILL.md +159 -0
- package/payload/platform/templates/agents/admin/IDENTITY.md +4 -0
- package/payload/platform/templates/specialists/agents/database-operator.md +3 -2
- package/payload/server/chunk-GOZP57CX.js +1373 -0
- package/payload/server/chunk-I4AQMEJA.js +11265 -0
- package/payload/server/chunk-INI2ED6U.js +2277 -0
- package/payload/server/chunk-JTZYXIUW.js +1373 -0
- package/payload/server/chunk-LQDUG4II.js +11336 -0
- package/payload/server/chunk-LU6TUP3E.js +2169 -0
- package/payload/server/chunk-RP25NRQY.js +660 -0
- package/payload/server/chunk-RRVBWC66.js +667 -0
- package/payload/server/client-pool-AIZ5QKFD.js +34 -0
- package/payload/server/client-pool-VYDOIFG7.js +34 -0
- package/payload/server/cloudflare-task-tracker-B6FXP3HI.js +20 -0
- package/payload/server/cloudflare-task-tracker-M7APAYEF.js +20 -0
- package/payload/server/maxy-edge.js +6 -5
- package/payload/server/public/assets/{Checkbox-BsqexMy3.js → Checkbox-CqsIsmEi.js} +1 -1
- package/payload/server/public/assets/admin-CZlNLb9T.js +352 -0
- package/payload/server/public/assets/data-CH-nQ7oX.js +1 -0
- package/payload/server/public/assets/graph-labels-D0qUVHtZ.js +1 -0
- package/payload/server/public/assets/graph-mpWDe4rf.js +1 -0
- package/payload/server/public/assets/{jsx-runtime-CGCRFPeX.css → jsx-runtime-Cy_HdZWV.css} +1 -1
- package/payload/server/public/assets/page-CnyySOZF.js +1 -0
- package/payload/server/public/assets/{page-qI0NJSs6.js → page-DcK36vDf.js} +2 -2
- package/payload/server/public/assets/public-SXA00FTv.js +5 -0
- package/payload/server/public/assets/{useVoiceRecorder-DVVSQc-9.js → useVoiceRecorder-DcByEBLy.js} +1 -1
- package/payload/server/public/data.html +5 -5
- package/payload/server/public/graph.html +6 -6
- package/payload/server/public/index.html +8 -8
- package/payload/server/public/public.html +5 -5
- package/payload/server/server.js +560 -448
- package/payload/server/public/assets/admin-pIeHRytz.js +0 -352
- package/payload/server/public/assets/data-rhAG7W2b.js +0 -1
- package/payload/server/public/assets/graph-DVAWZmkb.js +0 -1
- package/payload/server/public/assets/graph-labels-t_04n4zX.js +0 -1
- package/payload/server/public/assets/page-BM9O7QN8.js +0 -1
- package/payload/server/public/assets/public-oNo_2gt0.js +0 -5
- /package/payload/server/public/assets/{jsx-runtime-B8sGPXtT.js → jsx-runtime-BEjEWeaF.js} +0 -0
package/package.json
CHANGED
|
@@ -45,7 +45,7 @@ const UNIQUE_KEYS_BY_LABEL = {
|
|
|
45
45
|
Event: ["eventId"],
|
|
46
46
|
KnowledgeDocument: ["attachmentId"],
|
|
47
47
|
DigitalDocument: ["attachmentId"],
|
|
48
|
-
Conversation: ["conversationId"
|
|
48
|
+
Conversation: ["conversationId"],
|
|
49
49
|
Message: ["messageId"],
|
|
50
50
|
OnboardingState: ["accountId"],
|
|
51
51
|
Workflow: ["workflowId"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;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GAAG,EAAU,CAAC;IAC9B,KAAK,MAAM,CAAC,IAAI,MAAM;QAAE,KAAK,MAAM,CAAC,IAAI,oBAAoB,CAAC,CAAC,CAAC,IAAI,EAAE;YAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAClF,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC;AAClB,CAAC;AAED,2FAA2F;AAC9E,QAAA,oBAAoB,GAAsB,gBAAgB,CAAC"}
|
|
@@ -40,7 +40,7 @@ const UNIQUE_KEYS_BY_LABEL: Record<string, string[]> = {
|
|
|
40
40
|
Event: ["eventId"],
|
|
41
41
|
KnowledgeDocument: ["attachmentId"],
|
|
42
42
|
DigitalDocument: ["attachmentId"],
|
|
43
|
-
Conversation: ["conversationId"
|
|
43
|
+
Conversation: ["conversationId"],
|
|
44
44
|
Message: ["messageId"],
|
|
45
45
|
OnboardingState: ["accountId"],
|
|
46
46
|
Workflow: ["workflowId"],
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"note": "Flat document-to-chunk (alternative to HAS_SECTION then HAS_CHUNK)."
|
|
82
82
|
},
|
|
83
83
|
"REFERENCES": {
|
|
84
|
-
"direction": "(Message|KnowledgeDocument)-[:REFERENCES]->(*)",
|
|
85
|
-
"note": "Soft reference link."
|
|
84
|
+
"direction": "(Message|KnowledgeDocument|Task)-[:REFERENCES]->(*)",
|
|
85
|
+
"note": "Soft reference link. Task 892 added `Task` as a source: derived-insight tasks created from a `:Section:Conversation` chunk record their provenance via (:Task)-[:REFERENCES]->(:Section:Conversation) with a `contentHash` merge-key for idempotent re-runs."
|
|
86
86
|
},
|
|
87
87
|
"ABOUT": {
|
|
88
88
|
"direction": "(Review|Message)-[:ABOUT]->(*)",
|
|
@@ -102,7 +102,15 @@
|
|
|
102
102
|
},
|
|
103
103
|
"OBSERVED_IN": {
|
|
104
104
|
"direction": "(*)-[:OBSERVED_IN]->(Conversation)",
|
|
105
|
-
"note": "Observation provenance."
|
|
105
|
+
"note": "Observation provenance. Task 892: `:Section:Conversation` chunks (which carry the Conversation label) are valid OBSERVED_IN targets, so (:Preference)-[:OBSERVED_IN]->(:Section:Conversation) pattern-matches this annotation."
|
|
106
|
+
},
|
|
107
|
+
"MENTIONS": {
|
|
108
|
+
"direction": "(Section|Message|KnowledgeDocument)-[:MENTIONS]->(Person|Organization)",
|
|
109
|
+
"note": "Named entity reference. Task 892 added `Section` (typically Section:Conversation) as a source so chunk-anchored insight derivation can record who a transcript chunk mentions. KnowledgeDocument-source MENTIONS is the document-ingest path; Message-source MENTIONS is reserved for future per-message extraction."
|
|
110
|
+
},
|
|
111
|
+
"RELATED_TO": {
|
|
112
|
+
"direction": "(Person|Organization)-[:RELATED_TO]->(Person|Organization)",
|
|
113
|
+
"note": "Operator-confirmed relationship between two named entities derived from a transcript chunk (Task 892). Carries `operatorConfirmed: true` plus `relationshipType` naming the specific bond (`broker`, `colleague`, `referrer`, …). Distinct from typed edges like AUTHORED_BY or PARTICIPANT — RELATED_TO is the generic surface for relationships the operator confirmed at enrich time."
|
|
106
114
|
},
|
|
107
115
|
"HAS_IDENTITY": {
|
|
108
116
|
"direction": "(Agent)-[:HAS_IDENTITY]->(KnowledgeDocument)",
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Regression test for the Task 983 base64 context-overflow guard.
|
|
3
|
+
#
|
|
4
|
+
# Covers two PreToolUse rejection paths in pre-tool-use.sh:
|
|
5
|
+
#
|
|
6
|
+
# 1. Bash producer guard — `tool_input.command` invoking `base64` (encode
|
|
7
|
+
# direction) or `xxd -p` is rejected; `base64 -d|-D|--decode` is allowed.
|
|
8
|
+
# 2. Write/Edit consumer guard — `tool_input.content` (Write) or
|
|
9
|
+
# `tool_input.new_string` (Edit) carrying `data:<mime>;base64,<≥4096 chars>`
|
|
10
|
+
# is rejected; small inline data URIs and plain content are allowed.
|
|
11
|
+
#
|
|
12
|
+
# Plus a fail-open case (malformed stdin → exit 0 silent) to pin the contract
|
|
13
|
+
# established by the playwright-file-guard test (terminal-stdin guard + parse-
|
|
14
|
+
# error fail-open).
|
|
15
|
+
|
|
16
|
+
set -u
|
|
17
|
+
|
|
18
|
+
HOOK="$(cd "$(dirname "$0")/.." && pwd)/pre-tool-use.sh"
|
|
19
|
+
if [[ ! -x "$HOOK" ]]; then
|
|
20
|
+
echo "FAIL: $HOOK not executable" >&2
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
TMPFILES=()
|
|
25
|
+
cleanup_test_state() {
|
|
26
|
+
for f in "${TMPFILES[@]:-}"; do
|
|
27
|
+
[[ -n "$f" ]] && rm -f "$f" 2>/dev/null || true
|
|
28
|
+
done
|
|
29
|
+
}
|
|
30
|
+
trap cleanup_test_state EXIT
|
|
31
|
+
|
|
32
|
+
PASS=0
|
|
33
|
+
FAIL=0
|
|
34
|
+
pass() { echo "PASS: $1"; PASS=$((PASS + 1)); }
|
|
35
|
+
fail() { echo "FAIL: $1" >&2; FAIL=$((FAIL + 1)); }
|
|
36
|
+
|
|
37
|
+
# Helper: run hook with Bash tool_input.command and assert exit code + stderr.
|
|
38
|
+
run_bash() {
|
|
39
|
+
local command_text="$1"; local expected_rc="$2"; local stderr_pattern="$3"; local label="$4"
|
|
40
|
+
local input_json
|
|
41
|
+
# Build the input JSON via python3 so command_text with quotes / specials is safe.
|
|
42
|
+
input_json=$(python3 -c '
|
|
43
|
+
import json, sys
|
|
44
|
+
print(json.dumps({"hook_event_name": "PreToolUse", "tool_name": "Bash", "tool_input": {"command": sys.argv[1]}}, separators=(",", ":")))
|
|
45
|
+
' "$command_text")
|
|
46
|
+
local stdout_file; stdout_file=$(mktemp); TMPFILES+=("$stdout_file")
|
|
47
|
+
local stderr_file; stderr_file=$(mktemp); TMPFILES+=("$stderr_file")
|
|
48
|
+
printf '%s' "$input_json" | bash "$HOOK" admin >"$stdout_file" 2>"$stderr_file"
|
|
49
|
+
local rc=$?
|
|
50
|
+
if [[ "$rc" -ne "$expected_rc" ]]; then
|
|
51
|
+
fail "$label: expected exit $expected_rc, got $rc. Stderr: $(cat "$stderr_file")"
|
|
52
|
+
return
|
|
53
|
+
fi
|
|
54
|
+
if [[ -n "$stderr_pattern" ]] && ! grep -qE "$stderr_pattern" "$stderr_file"; then
|
|
55
|
+
fail "$label: stderr missing pattern '$stderr_pattern'. Got: $(cat "$stderr_file")"
|
|
56
|
+
return
|
|
57
|
+
fi
|
|
58
|
+
pass "$label"
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
# Helper: run hook with Write tool_input.content and assert exit code + stderr.
|
|
62
|
+
run_write() {
|
|
63
|
+
local content="$1"; local expected_rc="$2"; local stderr_pattern="$3"; local label="$4"
|
|
64
|
+
local input_json
|
|
65
|
+
input_json=$(python3 -c '
|
|
66
|
+
import json, sys
|
|
67
|
+
print(json.dumps({"hook_event_name": "PreToolUse", "tool_name": "Write", "tool_input": {"file_path": "/tmp/test.html", "content": sys.argv[1]}}, separators=(",", ":")))
|
|
68
|
+
' "$content")
|
|
69
|
+
local stdout_file; stdout_file=$(mktemp); TMPFILES+=("$stdout_file")
|
|
70
|
+
local stderr_file; stderr_file=$(mktemp); TMPFILES+=("$stderr_file")
|
|
71
|
+
printf '%s' "$input_json" | bash "$HOOK" admin >"$stdout_file" 2>"$stderr_file"
|
|
72
|
+
local rc=$?
|
|
73
|
+
if [[ "$rc" -ne "$expected_rc" ]]; then
|
|
74
|
+
fail "$label: expected exit $expected_rc, got $rc. Stderr: $(cat "$stderr_file")"
|
|
75
|
+
return
|
|
76
|
+
fi
|
|
77
|
+
if [[ -n "$stderr_pattern" ]] && ! grep -qE "$stderr_pattern" "$stderr_file"; then
|
|
78
|
+
fail "$label: stderr missing pattern '$stderr_pattern'. Got: $(cat "$stderr_file")"
|
|
79
|
+
return
|
|
80
|
+
fi
|
|
81
|
+
pass "$label"
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
# Helper: run hook with Edit tool_input.new_string and assert exit code.
|
|
85
|
+
run_edit() {
|
|
86
|
+
local new_string="$1"; local expected_rc="$2"; local stderr_pattern="$3"; local label="$4"
|
|
87
|
+
local input_json
|
|
88
|
+
input_json=$(python3 -c '
|
|
89
|
+
import json, sys
|
|
90
|
+
print(json.dumps({"hook_event_name": "PreToolUse", "tool_name": "Edit", "tool_input": {"file_path": "/tmp/test.html", "old_string": "OLD", "new_string": sys.argv[1]}}, separators=(",", ":")))
|
|
91
|
+
' "$new_string")
|
|
92
|
+
local stdout_file; stdout_file=$(mktemp); TMPFILES+=("$stdout_file")
|
|
93
|
+
local stderr_file; stderr_file=$(mktemp); TMPFILES+=("$stderr_file")
|
|
94
|
+
printf '%s' "$input_json" | bash "$HOOK" admin >"$stdout_file" 2>"$stderr_file"
|
|
95
|
+
local rc=$?
|
|
96
|
+
if [[ "$rc" -ne "$expected_rc" ]]; then
|
|
97
|
+
fail "$label: expected exit $expected_rc, got $rc. Stderr: $(cat "$stderr_file")"
|
|
98
|
+
return
|
|
99
|
+
fi
|
|
100
|
+
if [[ -n "$stderr_pattern" ]] && ! grep -qE "$stderr_pattern" "$stderr_file"; then
|
|
101
|
+
fail "$label: stderr missing pattern '$stderr_pattern'. Got: $(cat "$stderr_file")"
|
|
102
|
+
return
|
|
103
|
+
fi
|
|
104
|
+
pass "$label"
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
# Generate a base64-character blob >= 4096 chars (data-URI body trigger).
|
|
108
|
+
LARGE_B64=$(python3 -c "print('A' * 5000)")
|
|
109
|
+
|
|
110
|
+
# ───────── Bash producer guard ──────────────────────────────────────────────
|
|
111
|
+
run_bash "echo hello world" 0 "" \
|
|
112
|
+
"Test 1: bare Bash command (no base64) allowed"
|
|
113
|
+
|
|
114
|
+
run_bash "ls -la" 0 "" \
|
|
115
|
+
"Test 2: ls -la (no base64 token) allowed"
|
|
116
|
+
|
|
117
|
+
run_bash "base64 /tmp/foo.png" 2 '\[pre-tool-use\] guard=base64-tool-result.*tool=Bash.*reason=base64-encoder.*action=reject' \
|
|
118
|
+
"Test 3: 'base64 file' (encode) rejected"
|
|
119
|
+
|
|
120
|
+
run_bash "cat foo.png | base64" 2 '\[pre-tool-use\] guard=base64-tool-result.*action=reject' \
|
|
121
|
+
"Test 4: 'cat | base64' (encode pipeline) rejected"
|
|
122
|
+
|
|
123
|
+
run_bash "cat foo.png|base64 -w0" 2 '\[pre-tool-use\] guard=base64-tool-result.*action=reject' \
|
|
124
|
+
"Test 5: 'base64 -w0' (encode with line-wrap flag) rejected"
|
|
125
|
+
|
|
126
|
+
run_bash "xxd -p file.bin" 2 '\[pre-tool-use\] guard=base64-tool-result.*reason=xxd-plain-hex.*action=reject' \
|
|
127
|
+
"Test 6: 'xxd -p' (plain hex encode) rejected"
|
|
128
|
+
|
|
129
|
+
run_bash "base64 -d input.b64 > output.bin" 0 "" \
|
|
130
|
+
"Test 7: 'base64 -d' (decode direction) allowed"
|
|
131
|
+
|
|
132
|
+
run_bash "base64 --decode < x.b64 > y.bin" 0 "" \
|
|
133
|
+
"Test 8: 'base64 --decode' (decode long-form) allowed"
|
|
134
|
+
|
|
135
|
+
run_bash "echo Zm9v | base64 -d" 0 "" \
|
|
136
|
+
"Test 9: 'base64 -d' decode pipeline allowed"
|
|
137
|
+
|
|
138
|
+
run_bash "echo '--debug-base64-foo'" 0 "" \
|
|
139
|
+
"Test 10: 'base64' substring inside flag name does NOT false-match"
|
|
140
|
+
|
|
141
|
+
run_bash "ls mybase64tool" 0 "" \
|
|
142
|
+
"Test 11: 'base64' substring inside identifier does NOT false-match"
|
|
143
|
+
|
|
144
|
+
run_bash "cat in.b64 | base64 -d > /tmp/foo.bin; cat /tmp/bar.png | base64" 2 '\[pre-tool-use\] guard=base64-tool-result.*reason=base64-encoder.*action=reject' \
|
|
145
|
+
"Test 11b: compound (decode ; encode) rejects encoder segment (per-segment scan)"
|
|
146
|
+
|
|
147
|
+
run_bash "echo data | base64 -d > x.bin && cat y.png | base64 > y.b64" 2 '\[pre-tool-use\] guard=base64-tool-result.*action=reject' \
|
|
148
|
+
"Test 11c: compound (decode && encode) rejects encoder segment"
|
|
149
|
+
|
|
150
|
+
run_bash "base64 -d in.b64 > out.bin; base64 -d in2.b64 > out2.bin" 0 "" \
|
|
151
|
+
"Test 11d: compound (decode ; decode) allowed"
|
|
152
|
+
|
|
153
|
+
# ───────── Write/Edit consumer guard ────────────────────────────────────────
|
|
154
|
+
run_write "<html><body>hello world</body></html>" 0 "" \
|
|
155
|
+
"Test 12: Write small HTML content (no data URI) allowed"
|
|
156
|
+
|
|
157
|
+
run_write "<img src='data:image/png;base64,AAAA'>" 0 "" \
|
|
158
|
+
"Test 13: Write content with small inline data URI (<4096 chars) allowed"
|
|
159
|
+
|
|
160
|
+
run_write "<img src='data:image/png;base64,${LARGE_B64}'>" 2 '\[pre-tool-use\] guard=base64-write-content.*action=reject' \
|
|
161
|
+
"Test 14: Write content with large inline data URI (>4096 chars) rejected"
|
|
162
|
+
|
|
163
|
+
run_edit "<img src='data:image/png;base64,${LARGE_B64}'>" 2 '\[pre-tool-use\] guard=base64-write-content.*action=reject' \
|
|
164
|
+
"Test 15: Edit new_string with large inline data URI rejected"
|
|
165
|
+
|
|
166
|
+
run_edit "<p>just text replacement</p>" 0 "" \
|
|
167
|
+
"Test 16: Edit new_string with plain text allowed"
|
|
168
|
+
|
|
169
|
+
# ───────── Fail-open / structural ───────────────────────────────────────────
|
|
170
|
+
STDOUT_FILE=$(mktemp); STDERR_FILE=$(mktemp); TMPFILES+=("$STDOUT_FILE" "$STDERR_FILE")
|
|
171
|
+
printf '%s' 'not json at all { ' | bash "$HOOK" admin >"$STDOUT_FILE" 2>"$STDERR_FILE"
|
|
172
|
+
RC=$?
|
|
173
|
+
if [[ "$RC" -ne 0 ]]; then
|
|
174
|
+
fail "Test 17: malformed stdin should fail open (exit 0), got $RC. Stderr: $(cat "$STDERR_FILE")"
|
|
175
|
+
else
|
|
176
|
+
pass "Test 17: malformed stdin → silent passthrough (fail-open)"
|
|
177
|
+
fi
|
|
178
|
+
|
|
179
|
+
# Terminal-stdin guard preserved (no -t 0 test runs in test harness; assert
|
|
180
|
+
# the guard line exists in source).
|
|
181
|
+
if ! grep -q '\[ -t 0 \]' "$HOOK"; then
|
|
182
|
+
fail "Test 18: terminal stdin guard missing from hook source"
|
|
183
|
+
else
|
|
184
|
+
pass "Test 18: terminal stdin guard present in source"
|
|
185
|
+
fi
|
|
186
|
+
|
|
187
|
+
# Pre-existing guards still active — entitlement file edit still rejected.
|
|
188
|
+
ENT_JSON=$(python3 -c 'import json; print(json.dumps({"hook_event_name":"PreToolUse","tool_name":"Write","tool_input":{"file_path":"/srv/entitlement.json","content":"{\"tier\":\"max\"}"}}, separators=(",", ":")))')
|
|
189
|
+
STDOUT_FILE=$(mktemp); STDERR_FILE=$(mktemp); TMPFILES+=("$STDOUT_FILE" "$STDERR_FILE")
|
|
190
|
+
printf '%s' "$ENT_JSON" | bash "$HOOK" admin >"$STDOUT_FILE" 2>"$STDERR_FILE"
|
|
191
|
+
RC=$?
|
|
192
|
+
if [[ "$RC" -ne 2 ]]; then
|
|
193
|
+
fail "Test 19: pre-existing entitlement guard regressed (expected exit 2, got $RC)"
|
|
194
|
+
else
|
|
195
|
+
pass "Test 19: pre-existing entitlement guard still rejects entitlement.json"
|
|
196
|
+
fi
|
|
197
|
+
|
|
198
|
+
echo
|
|
199
|
+
echo "──────── pre-tool-use base64 guard test summary ────────"
|
|
200
|
+
echo "PASS: $PASS"
|
|
201
|
+
echo "FAIL: $FAIL"
|
|
202
|
+
|
|
203
|
+
[[ "$FAIL" -gt 0 ]] && exit 1
|
|
204
|
+
exit 0
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Archive-ingest surface gate (Task 855, updated by Task 891).
|
|
2
|
+
# Archive-ingest surface gate (Task 855, updated by Task 891, Task 892).
|
|
3
3
|
#
|
|
4
4
|
# Five enforcements, one script — phase decided by `hook_event_name` on stdin.
|
|
5
5
|
# Task 855 narrows the database-operator subagent's effective surface during
|
|
6
6
|
# WhatsApp archive ingestion to exactly one Bash entry
|
|
7
7
|
# (`memory/bin/conversation-archive-ingest.sh`) plus read-only neighbours, by
|
|
8
8
|
# blocking the legacy MCP deviation tools mechanically. Task 891 retired the
|
|
9
|
-
# `whatsapp-export-insight-pass` tool
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
9
|
+
# `whatsapp-export-insight-pass` tool; Task 892 reintroduces Phase 2 as
|
|
10
|
+
# `mcp__memory__conversation-archive-derive-insights` — a read-only tool that
|
|
11
|
+
# walks :Section:Conversation chunks of one named :ConversationArchive in
|
|
12
|
+
# pages and emits per-row proposals. The new tool is NOT in any BLOCK list
|
|
13
|
+
# (the gate is allow-by-default for unrecognised tools) — its writes go
|
|
14
|
+
# through the existing graph-cypher-write surface, gated by the operator per
|
|
15
|
+
# row in the conversation-archive-enrich skill. Stale references to the
|
|
16
|
+
# retired Phase 2 name (`whatsapp-export-insight-pass`) remain in the BLOCK
|
|
17
|
+
# list as a loud-denial breadcrumb for any operator-edited skill that still
|
|
18
|
+
# names them.
|
|
13
19
|
#
|
|
14
20
|
# 1. PreToolUse on the four legacy WhatsApp MCP tools — BLOCK unconditionally.
|
|
15
21
|
# The single deterministic Bash entry is the only supported path for
|
|
@@ -94,6 +94,102 @@ if [ "$AGENT_TYPE" = "admin" ]; then
|
|
|
94
94
|
;;
|
|
95
95
|
esac
|
|
96
96
|
|
|
97
|
+
# ── Base64 context-overflow guard (Task 983) ─────────────────────────────
|
|
98
|
+
# Block inline base64 payloads from reaching the model context. Two paths:
|
|
99
|
+
#
|
|
100
|
+
# 1. Bash command that ENCODES a binary file to base64/hex (the producer).
|
|
101
|
+
# 2. Write/Edit content carrying an inline `data:<mime>;base64,…` blob
|
|
102
|
+
# (the consumer — agent quoting bytes from a prior tool_result into a
|
|
103
|
+
# HTML/markdown Write).
|
|
104
|
+
#
|
|
105
|
+
# Either path landed ~33 KB of base64 in the SDK request and the next turn
|
|
106
|
+
# tripped `main_stream_stalled` at 180 s (see Task 983 reproduction). The
|
|
107
|
+
# remediation is symmetric: the agent saves bytes to `$ACCOUNT_DIR/tmp/<sha1>.<ext>`
|
|
108
|
+
# and references the path (`<img src="./file">` or Read-by-path) instead of
|
|
109
|
+
# carrying bytes through the assistant turn.
|
|
110
|
+
#
|
|
111
|
+
# Parsing uses python3 (already a hook dependency at the action-id site
|
|
112
|
+
# below); grep on JSON is unsafe for content with escaped quotes or
|
|
113
|
+
# embedded newlines. Parse failure is fail-open (empty extracted string,
|
|
114
|
+
# no match, allow) — matches the playwright-file-guard fail-open contract.
|
|
115
|
+
# Single python3 invocation parses the JSON, runs the tool-specific
|
|
116
|
+
# regex match (avoiding BSD-vs-GNU grep interval-count incompatibilities —
|
|
117
|
+
# `grep -E '{4096,}'` errors with "invalid repetition count(s)" on macOS
|
|
118
|
+
# BSD grep under some pattern combinations), and prints the rejection
|
|
119
|
+
# outcome to stdout as `REJECT:<reason>:<bytes>` or `ALLOW`. The wrapping
|
|
120
|
+
# bash logic reads the verdict and emits the rejection log/stderr/exit-2.
|
|
121
|
+
# Parse failure prints `ALLOW` (fail-open, matching the playwright-file-
|
|
122
|
+
# guard contract for malformed stdin).
|
|
123
|
+
GUARD_VERDICT=$(echo "$INPUT" | python3 -c '
|
|
124
|
+
import sys, json, re
|
|
125
|
+
try:
|
|
126
|
+
d = json.load(sys.stdin)
|
|
127
|
+
tool = d.get("tool_name", "")
|
|
128
|
+
ti = d.get("tool_input", {}) or {}
|
|
129
|
+
if tool in ("Write", "Edit"):
|
|
130
|
+
# Write.content OR Edit.new_string can carry inline base64.
|
|
131
|
+
content = ti.get("content") or ti.get("new_string") or ""
|
|
132
|
+
if not isinstance(content, str):
|
|
133
|
+
print("ALLOW"); sys.exit(0)
|
|
134
|
+
# data:<mime>;base64,<≥4096 base64 chars> — threshold matches the
|
|
135
|
+
# doctrine paragraph in .docs/agents.md. The 4096-char body is
|
|
136
|
+
# ~3 KB binary, far above any legitimate inline icon.
|
|
137
|
+
m = re.search(r"data:[^;]+;base64,[A-Za-z0-9+/]{4096,}={0,2}", content)
|
|
138
|
+
if m:
|
|
139
|
+
print(f"REJECT:base64-write-content:{len(content)}")
|
|
140
|
+
else:
|
|
141
|
+
print("ALLOW")
|
|
142
|
+
elif tool == "Bash":
|
|
143
|
+
command = ti.get("command", "")
|
|
144
|
+
if not isinstance(command, str):
|
|
145
|
+
print("ALLOW"); sys.exit(0)
|
|
146
|
+
# Per-segment scan. A compound command like
|
|
147
|
+
# cat in.b64 | base64 -d > out.bin; cat photo.png | base64
|
|
148
|
+
# contains both a legitimate decode AND a malicious encoder. A whole-
|
|
149
|
+
# command decode-flag check is fooled into allowing the encoder. Split
|
|
150
|
+
# on shell separators (;, &&, ||, &) and scan each segment as its own
|
|
151
|
+
# command — the encoder rejection fires when ANY segment is a bare
|
|
152
|
+
# base64 invocation without a paired decode flag in the SAME segment.
|
|
153
|
+
# Pipelines (|) keep the segment together because the encoder direction
|
|
154
|
+
# of `cat file | base64` lives across the pipe.
|
|
155
|
+
segments = re.split(r";|&&|\|\||(?<![|&])&(?![|&])", command)
|
|
156
|
+
rejected = None
|
|
157
|
+
for seg in segments:
|
|
158
|
+
if re.search(r"(?:^|[\s|;&])xxd[\t ]+-p(?![A-Za-z0-9_-])", seg):
|
|
159
|
+
rejected = "xxd-plain-hex"; break
|
|
160
|
+
if re.search(r"(?:^|[\s|;&])base64(?![A-Za-z0-9_-])", seg):
|
|
161
|
+
if not re.search(r"base64[\t ]+[^|]*(?:-d|-D|--decode)(?![A-Za-z0-9_])", seg):
|
|
162
|
+
rejected = "base64-encoder"; break
|
|
163
|
+
if rejected:
|
|
164
|
+
print(f"REJECT:{rejected}:{len(command)}")
|
|
165
|
+
else:
|
|
166
|
+
print("ALLOW")
|
|
167
|
+
else:
|
|
168
|
+
print("ALLOW")
|
|
169
|
+
except Exception:
|
|
170
|
+
print("ALLOW")
|
|
171
|
+
' 2>/dev/null || echo "ALLOW")
|
|
172
|
+
case "$GUARD_VERDICT" in
|
|
173
|
+
REJECT:base64-write-content:*)
|
|
174
|
+
BYTES="${GUARD_VERDICT##*:}"
|
|
175
|
+
echo "[pre-tool-use] guard=base64-write-content bytes=${BYTES} action=reject" >&2
|
|
176
|
+
echo "Blocked: ${TOOL_NAME} content carries an inline base64 payload (>4 KB encoded). Inline binary in Write.content overloads the model context — the same path produced a main_stream_stalled at ~33 KB on 2026-05-09." >&2
|
|
177
|
+
echo "Save the bytes to \$ACCOUNT_DIR/tmp/<sha1>.<ext> via Bash (e.g. 'base64 -d > out.png'), then reference the file from the document: <img src=\"./<file>\"> or Read-by-path. Do not carry binary bytes through the assistant turn." >&2
|
|
178
|
+
exit 2
|
|
179
|
+
;;
|
|
180
|
+
REJECT:base64-encoder:*|REJECT:xxd-plain-hex:*)
|
|
181
|
+
REASON="${GUARD_VERDICT#REJECT:}"; REASON="${REASON%:*}"
|
|
182
|
+
BYTES="${GUARD_VERDICT##*:}"
|
|
183
|
+
echo "[pre-tool-use] guard=base64-tool-result bytes=${BYTES} tool=Bash reason=${REASON} action=reject" >&2
|
|
184
|
+
echo "Blocked: Bash command would emit binary as inline base64/hex to stdout, which lands in the assistant turn and overloads the model context (the 2026-05-09 Rubytech-invoice path hit 66% context after a single ~33 KB tool_result)." >&2
|
|
185
|
+
echo "Instead: save the bytes directly to \$ACCOUNT_DIR/tmp/<sha1>.<ext> and operate on the file via path — Read for inspection, <img src=\"./<file>\"> for HTML embedding, file-attach for delivery. Decoding base64 (e.g. 'base64 -d in.b64 > out.bin') is allowed." >&2
|
|
186
|
+
exit 2
|
|
187
|
+
;;
|
|
188
|
+
*)
|
|
189
|
+
: # ALLOW — fall through to approval gating below
|
|
190
|
+
;;
|
|
191
|
+
esac
|
|
192
|
+
|
|
97
193
|
# ── Approval gating (EU AI Act Article 14 — human oversight) ─────────────
|
|
98
194
|
# Strip the mcp__<plugin>__ prefix to get the short tool name.
|
|
99
195
|
# Built-in tools (no prefix) pass through unchanged.
|
|
@@ -154,7 +154,11 @@ Then call `render-component` with `name: "cloudflare-setup-form"` and data conta
|
|
|
154
154
|
|
|
155
155
|
Wait for the user's submission. The `_componentDone` payload contains the `setup-tunnel.sh` output verbatim. Relay that output to the user — quote any `ACTION REQUIRED` block exactly. When the script exits zero, step-7 completion has already been persisted by the script itself — relay the output and stop. Do not call `onboarding-complete-step` with step 7; the script is the authority for step-7 completion, and any call you make after the script's restart dispatch would race the service restart and almost always lose. If the script failed (the endpoint returned `ok: false, field: "script"`), the form surfaced the error and stayed open — relay the output, cite `plugins/cloudflare/references/reset-guide.md` for recovery, and offer to re-render the form after any manual steps. Do not synthesise alternative recovery commands. If the user skipped (step 7 not reached), call `onboarding-complete-step` with step 7 so the next session resumes at step 8.
|
|
156
156
|
|
|
157
|
-
**Post-restart resume contract.** A successful Cloudflare setup arms a brand-service restart that kills the in-flight admin agent
|
|
157
|
+
**Post-restart resume contract.** A successful Cloudflare setup arms a brand-service restart that kills the in-flight admin agent. The operator's "Cloudflare setup completed" message is replayed by the chat client after the restart cycle completes. Two pathways converge on the same agent-visible outcome:
|
|
158
|
+
- **Default (Task 982).** The operator's admin sessionKey is a Task-653-style signed token (`v1.…` HMAC) that survives the restart. `validateSession` rehydrates the in-memory session from the token, the chat-route binds the prior `conversationId` via `getMostRecentAdminConversationForUser`, and the SDK's next cold-create passes `resume: <priorAgentSessionId>` — the marker turn lands in the SAME conversation with the SDK's JSONL transcript intact.
|
|
159
|
+
- **Fallback.** If the signed-token rehydrate fails (token tampered, TTL expired, pre-Task-982 legacy sessionKey), the chat client falls through to `POST /api/admin/sessions/<cid>/resume` via the surviving `__remote_session` cookie. Outcome from your view as the admin agent is identical.
|
|
160
|
+
|
|
161
|
+
By the time you receive the marker, `OnboardingState.currentStep` is already 7 (the script's filesystem flag was consumed by `consumeStep7FlagUI` on the way in). The operator told you "Cloudflare setup completed (actionId: …)" at currentStep=7. Acknowledge, then proceed to step 8 — do NOT re-ask the Cloudflare question, do NOT re-render the cloudflare-setup-form, do NOT call `onboarding-complete-step` with step 7 (already done). The marker turn is your single source of truth that step 7 finished cleanly; the script's flag-consume is the orthogonal proof that the state machine advanced.
|
|
158
162
|
|
|
159
163
|
## Step 8 — Anthropic API key
|
|
160
164
|
|
|
@@ -212,8 +212,16 @@ if [ ! -f "${CFG_DIR}/cert.pem" ]; then
|
|
|
212
212
|
# callback forever; subsequent setup-tunnel runs see a stale cert.pem
|
|
213
213
|
# landing asynchronously and race against the new URL-extraction pass.
|
|
214
214
|
CF_PIPELINE_PID=""
|
|
215
|
+
CHROMIUM_UNIT=""
|
|
215
216
|
cleanup_oauth() {
|
|
216
217
|
[ -n "${CF_PIPELINE_PID}" ] && kill "${CF_PIPELINE_PID}" 2>/dev/null || true
|
|
218
|
+
# Task 982 — stop the transient chromium unit on any early exit between
|
|
219
|
+
# browser-spawn and the explicit step=browser-close site below. Best-
|
|
220
|
+
# effort: no phase_line here because the EXIT trap fires on every path
|
|
221
|
+
# (including the happy one where step=browser-close already ran and
|
|
222
|
+
# auto-collected the unit). The `|| true` masks the inevitable "Unit
|
|
223
|
+
# not loaded" return on the happy path.
|
|
224
|
+
[ -n "${CHROMIUM_UNIT}" ] && systemctl --user stop "${CHROMIUM_UNIT}" 2>/dev/null || true
|
|
217
225
|
rm -f "${URL_FILE}" "${LAST_LINE_FILE}"
|
|
218
226
|
}
|
|
219
227
|
trap cleanup_oauth EXIT
|
|
@@ -276,12 +284,19 @@ if [ ! -f "${CFG_DIR}/cert.pem" ]; then
|
|
|
276
284
|
# Mechanically open the URL on the Pi VNC chromium (Task 858). Chromium
|
|
277
285
|
# is already running on this brand's ${BRAND_VNC_DISPLAY} with CDP enabled
|
|
278
286
|
# (vnc.sh start_chrome at boot); invoking the resolved binary <url> against
|
|
279
|
-
# a running instance IPCs the URL into it as a new tab.
|
|
280
|
-
#
|
|
281
|
-
#
|
|
282
|
-
#
|
|
283
|
-
#
|
|
284
|
-
#
|
|
287
|
+
# a running instance IPCs the URL into it as a new tab. Replaces
|
|
288
|
+
# cloudflared's own optimistic xdg-open, which does not reliably target
|
|
289
|
+
# the brand's VNC display in this environment.
|
|
290
|
+
#
|
|
291
|
+
# Task 982 — chromium is launched under a transient systemd-user unit so
|
|
292
|
+
# the full process tree (including any standalone chromium that lands
|
|
293
|
+
# when no existing instance is running for IPC) lives in its own cgroup.
|
|
294
|
+
# On cert.pem arrival the unit is stopped, SIGTERMing the whole cgroup
|
|
295
|
+
# atomically. Pre-Task-982 the spawn was `&` fire-and-forget with no
|
|
296
|
+
# tracked PID; the resulting orphan chromium on display :101 was the
|
|
297
|
+
# symptom in maxy-2 2026-05-12T10:06–10:08Z. `step=browser-close
|
|
298
|
+
# result=ok|orphan` records the teardown outcome at cert.pem mv site
|
|
299
|
+
# below.
|
|
285
300
|
#
|
|
286
301
|
# Binary path: SETUP_TUNNEL_CHROMIUM_BIN is read at startup from
|
|
287
302
|
# ${MAXY_PLATFORM_ROOT}/config/chromium-binary.path — `/usr/bin/chromium`
|
|
@@ -289,9 +304,34 @@ if [ ! -f "${CFG_DIR}/cert.pem" ]; then
|
|
|
289
304
|
# where the system chromium is snap-confined (Task 929). Hardcoding
|
|
290
305
|
# `/usr/bin/chromium` here would re-introduce the AppArmor SingletonLock
|
|
291
306
|
# failure on the laptop.
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
307
|
+
CHROMIUM_UNIT="maxy-oauth-chromium-${BRAND}-$$.service"
|
|
308
|
+
CHROMIUM_LAUNCH_DISPLAY="${DISPLAY:-${BRAND_VNC_DISPLAY}}"
|
|
309
|
+
CHROMIUM_SPAWN_ERR="$(mktemp -t maxy-oauth-chromium-err.XXXXXX)"
|
|
310
|
+
if systemd-run --user \
|
|
311
|
+
--unit="${CHROMIUM_UNIT}" \
|
|
312
|
+
--description="Maxy OAuth chromium for ${BRAND}" \
|
|
313
|
+
--collect \
|
|
314
|
+
--setenv=DISPLAY="${CHROMIUM_LAUNCH_DISPLAY}" \
|
|
315
|
+
"${SETUP_TUNNEL_CHROMIUM_BIN}" "${AUTH_URL}" 2>"${CHROMIUM_SPAWN_ERR}"; then
|
|
316
|
+
rm -f "${CHROMIUM_SPAWN_ERR}"
|
|
317
|
+
phase_line setup-tunnel step=browser-spawn result=ok \
|
|
318
|
+
display="${CHROMIUM_LAUNCH_DISPLAY}" url_extracted=1 unit="${CHROMIUM_UNIT}"
|
|
319
|
+
else
|
|
320
|
+
SPAWN_RC=$?
|
|
321
|
+
SPAWN_STDERR="$(tr '\n' ' ' < "${CHROMIUM_SPAWN_ERR}" | head -c 300 || echo unavailable)"
|
|
322
|
+
rm -f "${CHROMIUM_SPAWN_ERR}"
|
|
323
|
+
# Loud-fail rather than fire-and-forget fallback: a systemd-run failure
|
|
324
|
+
# is the same class as the pre-Task-982 orphan (no teardown handle).
|
|
325
|
+
# Operator should see the bus-not-running / linger-not-enabled cause.
|
|
326
|
+
phase_line setup-tunnel step=browser-spawn result=error \
|
|
327
|
+
reason=systemd-run-failed exit="${SPAWN_RC}" stderr="${SPAWN_STDERR}" \
|
|
328
|
+
unit="${CHROMIUM_UNIT}"
|
|
329
|
+
echo "ERROR: systemd-run failed to spawn chromium under transient unit (exit=${SPAWN_RC})." >&2
|
|
330
|
+
echo " systemd-run stderr: ${SPAWN_STDERR}" >&2
|
|
331
|
+
echo " If stderr mentions 'Failed to connect to bus', enable user-scope" >&2
|
|
332
|
+
echo " systemd via 'loginctl enable-linger \$(whoami)' and retry." >&2
|
|
333
|
+
exit 1
|
|
334
|
+
fi
|
|
295
335
|
phase_line setup-tunnel step=browser-drive mode=operator-click url="${AUTH_URL}"
|
|
296
336
|
|
|
297
337
|
# Wait for cert.pem to land — cloudflared writes to ~/.cloudflared/cert.pem
|
|
@@ -335,6 +375,45 @@ if [ ! -f "${CFG_DIR}/cert.pem" ]; then
|
|
|
335
375
|
mv "${HOME}/.cloudflared/cert.pem" "${CFG_DIR}/cert.pem"
|
|
336
376
|
phase_line setup-tunnel step=oauth-login result=ok \
|
|
337
377
|
path="${CFG_DIR}/cert.pem" waited="${LOGIN_WAIT}s"
|
|
378
|
+
|
|
379
|
+
# Task 982 — SIGTERM the OAuth chromium cgroup now that cert.pem has
|
|
380
|
+
# landed. The transient unit was created above at step=browser-spawn; if
|
|
381
|
+
# chromium IPCs'd to a running brand-VNC instance and exited cleanly, the
|
|
382
|
+
# unit is already auto-collected and `systemctl stop` returns 0 (no-such-
|
|
383
|
+
# unit is a benign race, not an orphan). If chromium is still alive (no
|
|
384
|
+
# pre-existing brand-VNC instance to IPC into), SIGTERM tears the whole
|
|
385
|
+
# cgroup atomically. `result=ok` covers both clean paths; `result=orphan`
|
|
386
|
+
# fires only when the stop command itself fails (bus issue, race with
|
|
387
|
+
# auto-collect that returned non-zero) — operator-visible signal that an
|
|
388
|
+
# orphan chromium MAY still be alive on the VNC display.
|
|
389
|
+
CHROMIUM_STOP_ERR="$(mktemp -t maxy-oauth-chromium-stop-err.XXXXXX)"
|
|
390
|
+
if systemctl --user stop "${CHROMIUM_UNIT}" 2>"${CHROMIUM_STOP_ERR}"; then
|
|
391
|
+
rm -f "${CHROMIUM_STOP_ERR}"
|
|
392
|
+
phase_line setup-tunnel step=browser-close result=ok unit="${CHROMIUM_UNIT}"
|
|
393
|
+
else
|
|
394
|
+
STOP_RC=$?
|
|
395
|
+
STOP_STDERR="$(tr '\n' ' ' < "${CHROMIUM_STOP_ERR}" | head -c 300 || echo unavailable)"
|
|
396
|
+
rm -f "${CHROMIUM_STOP_ERR}"
|
|
397
|
+
# Distinguish benign "unit already auto-collected" from a true teardown
|
|
398
|
+
# failure via systemctl's exit-code taxonomy — never via stderr prose
|
|
399
|
+
# parsing, which breaks on non-English locales (no-stdout-parsing-for-
|
|
400
|
+
# control-flow doctrine). Exit code 5 is systemd's canonical "Unit not
|
|
401
|
+
# loaded" return; --collect auto-GCs a terminated unit between the
|
|
402
|
+
# chromium-side IPC-and-exit and our stop, producing exactly this code.
|
|
403
|
+
# Any other non-zero exit is a real teardown failure (bus down, permission,
|
|
404
|
+
# service still alive but stop hung).
|
|
405
|
+
if [ "${STOP_RC}" -eq 5 ]; then
|
|
406
|
+
phase_line setup-tunnel step=browser-close result=ok \
|
|
407
|
+
reason=unit-auto-collected unit="${CHROMIUM_UNIT}"
|
|
408
|
+
else
|
|
409
|
+
phase_line setup-tunnel step=browser-close result=orphan \
|
|
410
|
+
reason=stop-failed exit="${STOP_RC}" stderr="${STOP_STDERR}" \
|
|
411
|
+
unit="${CHROMIUM_UNIT}"
|
|
412
|
+
echo "WARNING: failed to stop transient chromium unit ${CHROMIUM_UNIT} (exit=${STOP_RC})." >&2
|
|
413
|
+
echo " An orphan chromium may remain on display ${CHROMIUM_LAUNCH_DISPLAY}." >&2
|
|
414
|
+
echo " systemctl stderr: ${STOP_STDERR}" >&2
|
|
415
|
+
fi
|
|
416
|
+
fi
|
|
338
417
|
fi
|
|
339
418
|
|
|
340
419
|
# --------------------------------------------------------------------------
|
|
@@ -22,7 +22,7 @@ Any Cloudflare action outside these four surfaces is a discipline violation —
|
|
|
22
22
|
|
|
23
23
|
Use this when the operator wants Cloudflare set up (or re-set up) end-to-end on the device. The script handles OAuth login, tunnel creation, DNS routing for each subdomain, config.yml + tunnel.state, and dispatches the `${BRAND}.service` restart to a transient `systemd-run` unit — all in one invocation. The restart fires a few seconds after the script exits so the script does not kill its own cgroup when invoked via the Bash tool; the chat UI receives a `server_shutdown` SSE frame and reconnects automatically. Post-restart hostname verification is out of scope for the script (connector is not up when the script exits) — verify via the next admin turn or manually with `curl -I https://<hostname>`. Apex hostnames cannot be routed by the CLI; when one is passed, the script prints an `ACTION REQUIRED` block naming the exact dashboard record to edit.
|
|
24
24
|
|
|
25
|
-
Step 1's OAuth flow is a state machine over two observable variables: the brand-scoped cert path (`${CFG_DIR}/cert.pem`) and the OAuth-default cert path (`~/.cloudflared/cert.pem`). When the brand-scoped cert is missing but the default-path cert is present from any prior partial run, the wrapper promotes it (`mv`) and emits `step=oauth-login result=ok reason=cert-promoted-from-default-path` without re-spawning cloudflared. When both are missing, the wrapper spawns `cloudflared tunnel login`, extracts the argotunnel URL from its stdout, and the instant the URL surfaces, mechanically opens it on the brand's VNC chromium
|
|
25
|
+
Step 1's OAuth flow is a state machine over two observable variables: the brand-scoped cert path (`${CFG_DIR}/cert.pem`) and the OAuth-default cert path (`~/.cloudflared/cert.pem`). When the brand-scoped cert is missing but the default-path cert is present from any prior partial run, the wrapper promotes it (`mv`) and emits `step=oauth-login result=ok reason=cert-promoted-from-default-path` without re-spawning cloudflared. When both are missing, the wrapper spawns `cloudflared tunnel login`, extracts the argotunnel URL from its stdout, and the instant the URL surfaces, mechanically opens it on the brand's VNC chromium under a transient `systemd-run --user --unit=maxy-oauth-chromium-${BRAND}-$$.service` so the chromium process tree lives in its own cgroup (Task 982 — pre-Task-982 the spawn was `&` fire-and-forget and orphaned chromium on display `:101` when no pre-existing brand-VNC chromium was available for IPC). The launch uses the install-time-resolved binary (`SETUP_TUNNEL_CHROMIUM_BIN` from `${MAXY_PLATFORM_ROOT}/config/chromium-binary.path` so Ubuntu Noble laptop's snap-replaced Google Chrome is honoured per Task 929) — emitting `step=browser-spawn result=ok unit=<transient-unit>` and `step=browser-drive mode=operator-click`. The operator clicks the zone row + Authorize on the VNC; cloudflared's callback writes `~/.cloudflared/cert.pem`; the wrapper's cert-poll (180 s budget) picks it up and `mv`s it to the brand-scoped path; the wrapper then `systemctl --user stop`s the transient unit, emitting `step=browser-close result=ok` (or `result=orphan reason=stop-failed` when SIGTERM didn't reach the cgroup — operator-visible signal that an orphan chromium MAY still be alive). There is no CDP auto-click, no DOM matcher, no consent-page driver — the wrapper's job is to faithfully relay `cloudflared tunnel login`, never to layer automation on top.
|
|
26
26
|
|
|
27
27
|
### How inputs reach the script
|
|
28
28
|
|